<?php
declare (strict_types = 1);

namespace app\api\model\yuql;

use think\Model;

/**
 * @mixin \think\Model
 */
class Purchase extends Model
{
    protected $table = '2008a_store_purchase';

    /**
     * yuql
     * 查询一条记录数据
     * @param $data
     * @return Search|array|mixed|Model|null
     */
    public static function HistoryOne($data){
        $result = Purchase::where($data)->find();
        return $result;
    }
    /**
     * yuql
     * 用户订单记录入库
     * @param $date
     * @return Search|Model
     */
    public static function HistorySet($date){
        $result = Purchase::create($date);
        return $result;
    }

    /**
     * yuql
     * 用户搜索记录入库
     * @param $date
     * @return Search|Model
     */
    public static function HistorySave($date){
        $result = Purchase::where($date)->find();
        $result->save();
        return $result;
    }

    public static function HistoryS($data){
        $result = Purchase::where($data)->select()->toArray();
        return $result;
    }
}
